<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html" ; charset="utf-8" />
    <title>业绩查询</title>
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />
    <link
      href="../../../bstable/css/bootstrap.min.css"
      rel="stylesheet"
      type="text/css"
    />
    <link
      href="../../../bstable/css/bootstrap-table.css"
      rel="stylesheet"
      type="text/css"
    />

    <style>
      .bootstrap-table {
        padding: 20px;
      }
    </style>
  </head>

  <body>
    <div class="tabe_div">
      <p class="p_line text_ient" style="margin-bottom: -10px">
        <!-- <a class="find_a">业务进度：</a>
            <select class="form_select" style="padding-left: 1%;" id="businessProgress">
                <option value="">全部</option>
                <option value="0">报考</option>
                <option value="1">退款</option>
                <option value="2">分期缴费</option>
            </select> -->
        <a class="find_a">日期范围：</a>
        <input
          id="start"
          class="fee-time form_input text_ient"
          type="date"
          value=""
        />
        -
        <input
          id="end"
          class="fee-time form_input text_ient"
          type="date"
          value=""
        />
        <a class="find_a">业务小组：</a>
        <select
          class="form_select"
          style="padding-left: 1%"
          id="group"
        ></select>
        <input type="button" value="查询" class="but_find" id="search" />
      </p>
      <table
        data-url="json/data_alae_list.json"
        id="table"
        class="table_style"
        style="margin: 0 auto"
      ></table>
    </div>
    <script src="../../../js/jquery.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../js/date/js/laydate.js"></script>
    <script src="../../../bstable/js/bootstrap.min.js"></script>
    <script src="../../../bstable/js/bootstrap-table.js"></script>
    <script src="../../../bstable/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../../layer_v2.1/layer/layer.js"></script>
    <script type="text/javascript">
      localStorage.setItem("name", "团队管理/业绩查询");

      queryGroup();
      //查询业务小组
      function queryGroup(obj) {
        $.ajax({
          url: baseUrl + "businessdirector/listAll",
          method: "Post",
          headers: {
            Authorization: JSON.parse(localStorage.getItem("userInfo")).token,
          },
          data: "",
          success: function (data) {
            var html_ = '<option value="">请选择</option>';
            for (var i = 0; i < data.data.length; i++) {
              var item = data.data[i];
              html_ +=
                '<option  value="' +
                item.id +
                '" >' +
                item.businessTeam +
                "</option>";
            }
            $("#group").html(html_);
          },
        });
      }

      $(function () {
        $("#search").on("click", function () {
          $("#table").bootstrapTable("refresh");
        });
        var perm = JSON.parse(localStorage.getItem("userInfo")).perm;
        const userId = JSON.parse(localStorage.getItem("userInfo")).userId;
        $("#table").bootstrapTable({
          method: "get",
          striped: true,
          singleSelect: false,
          url: baseUrl + "performance/selectPerformanceDetail",
          dataType: "json",
          sidePagination: "server",
          pagination: true, //分页
          pageSize: 10,
          pageNumber: 1,
          // rowStyle:rowStyle,
          search: false, //显示搜索框
          contentType: "application/x-www-form-urlencoded",
          ajaxOptions: {
            headers: {
              Authorization: JSON.parse(localStorage.getItem("userInfo")).token,
            },
          },
          queryParams: function (params) {
            params.userId = userId;
            params.startDate = $("#start").val();
            params.endDate = $("#end").val();
            params.businessProgress = $("#businessProgress").val();
            params.businessId = $("#group").val();
            params.userType = "team";
            params.offset = params.offset / params.limit;
            delete params.order;
            return params;
          },
          responseHandler: function (res) {
            console.log(res);
            var list = res.data.result.records;
            var maps = {
              education: "学历提升",
              occupation: "职业技能",
              title: "职称评审",
              train: "执业资格",
            };
            list.forEach(function (item, i) {
              item.trainType = maps[item.trainType];
              !item && (list[i] = {});
              item.feeFlag = item.feeFlag == 1 ? "已缴费" : "未缴费";
            });

            return {
              rows: list,
              total: res.data.total,
            };
          },
          columns: [
            {
              field: "no",
              title: "序号",
              sortable: true,
              align: "center",
              formatter: function (value, row, index) {
                var pageSize =
                  $("#table").bootstrapTable("getOptions").pageSize;
                var pageNumber =
                  $("#table").bootstrapTable("getOptions").pageNumber;
                return pageSize * (pageNumber - 1) + index + 1;
              },
            },
            {
              title: "业务小组",
              field: "supervisorsName",
              align: "center",
              valign: "middle",
            },
            {
              title: "招生老师",
              field: "teacherName",
              align: "center",
            },
            {
              title: "学历业绩",
              field: "educationFee",
              align: "center",
            },
            {
              title: "职业技能业绩",
              field: "occupationFee",
              align: "center",
            },
            {
              title: "职称技能业绩",
              field: "titleFee",
              align: "center",
            },
            {
              title: "执业资格业绩",
              field: "trainFee",
              align: "center",
            },
            {
              title: "退款",
              field: "refundableFee",
              align: "center",
            },
            {
              title: "合计",
              field: "performanceAllFee",
              align: "center",
            },
          ],
        });
      });

      function config(id, idNo, flag) {
        window.location.href =
          "../student/edit.html?type=look&from=tuanduiyeji&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag;
      }

      // function rowStyle(item, index) {
      //     style = item.colorFlag == 1 ? {css:{'color':'#ed5565'}} : {}
      //     return style;
      // }
    </script>
  </body>
</html>
